< previous page page_12 next page >

Page 12
e10a6a0a59f035e870d90cca05b85fce.gif
Dim extra_wid As Single
Dim extra_hgt As Single

    ' Convert the desired width and height from
    ' twips into the form's custom coordinates.
    wid = Me.ScaleX(2500, 1, 0)
    hgt = Me.ScaleY(1500, 1, 0)

    WrongPict.Width = wid
    WrongPict.Height = hgt
    WrongPict.Line (0, 750)(1250, 0)
    WrongPict.Line (2500, 750)
    WrongPict.Line (1250, 1500)
    WrongPict.Line (0, 750)

    With RightPict
        extra_wid = .Width  Me.ScaleX( _
            .ScaleWidth, .ScaleMode, Me.ScaleMode)
        extra_hgt = .Height  Me.ScaleY( _
            .ScaleHeight, .ScaleMode, Me.ScaleMode)
         .Width = wid + extra_wid
         .Height = hgt + extra_hgt
     End With 
     RightPict.Line (0, 750)(1250, 0)
     RightPict.Line (2500, 750)
     RightPict.Line (1250, 1500)
     RightPict.Line (0, 750)
End Sub
This method for using a custom coordinate system works well as long as you do not need to locate points too close to the right or bottom edges of the drawing object. Points very close to the right and bottom edges will fall just outside the drawing object's inte-
0012-01.jpg
Figure 1.5
Program BoxSize shows the right
and wrong way to size a picture box.

 
< previous page page_12 next page >